<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function djs(times) {
            var date = new Date();
            var date1 = new Date(times);
            var sec = (date1.getTime() - date.getTime()) / 1000;
            var d = parseInt(sec / 60 / 60 / 24);
            var h = parseInt(sec / 60 / 60 % 24);
            var m = parseInt(sec / 60 % 60);
            var s = parseInt(sec % 60);
            return '距离' + times + '还有' + d + '天' + h + '时' + m + '分' + s + '秒';
        }
        alert(djs('2021-02-27 02:14:00'));
    </script>
</head>

<body>

</body>

</html>